﻿<html>

<head>
<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<meta name=Generator content="Microsoft Word 14 (filtered)">
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:"\@宋体";
	panose-1:2 1 6 0 3 1 1 1 1 1;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:"Times New Roman","serif";}
h1
	{mso-style-link:"标题 1 Char";
	margin-right:0cm;
	margin-left:0cm;
	font-size:24.0pt;
	font-family:宋体;}
p.MsoHeader, li.MsoHeader, div.MsoHeader
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	layout-grid-mode:char;
	border:none;
	padding:0cm;
	font-size:9.0pt;
	font-family:"Times New Roman","serif";}
p.MsoFooter, li.MsoFooter, div.MsoFooter
	{margin:0cm;
	margin-bottom:.0001pt;
	layout-grid-mode:char;
	font-size:9.0pt;
	font-family:"Times New Roman","serif";}
span.1Char
	{mso-style-name:"标题 1 Char";
	mso-style-link:"标题 1";
	font-family:宋体;
	font-weight:bold;}
 /* Page Definitions */
 @page WordSection1
	{size:595.3pt 841.9pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	layout-grid:15.6pt;}
div.WordSection1
	{page:WordSection1;}
 /* List Definitions */
 ol
	{margin-bottom:0cm;}
ul
	{margin-bottom:0cm;}
-->
</style>

</head>

<body bgcolor=white lang=ZH-CN style='text-justify-trim:punctuation'>

<div class=WordSection1 style='layout-grid:15.6pt'>

<h1 align=center style='text-align:center'>函数的应用</h1>

<p class=MsoNormal><span style='font-family:宋体;color:#555555;background:white'>在前面已经介绍过，Ｃ源程序是由函数组成的。虽然在前面各章的程序中大都只有一个主函数</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>main()</span><span style='font-family:宋体;color:#555555;background:white'>，但实用程序往往由多个函数组成。函数是Ｃ源程序的基本模块，通过对函数模块的调用实现特定的功能。Ｃ语言中的函数相当于其它高级语言的子程序。Ｃ语言不仅提供了极为丰富的库函数</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>(</span><span style='font-family:宋体;color:#555555;background:white'>如</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>Turbo C</span><span style='font-family:宋体;color:#555555;background:white'>，</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>MS C</span><span style='font-family:宋体;color:#555555;background:white'>都提供了三百多个库函数</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>)</span><span style='font-family:宋体;color:#555555;background:white'>，还允许用户建立自己定义的函数。用户可把自己的算法编成一个个相对独立的函数模块，然后用调用的方法来使用函数。可以说Ｃ程序的全部工作都是由各式各样的函数完成的，所以也把Ｃ语言称为函数式语言。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>由于采用了函数模块式的结构，Ｃ语言易于实现结构化程序设计。使程序的层次结构清晰，便于程序的编写、阅读、调试。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><strong style='text-decoration:initial'><span style='font-family:宋体;
color:red;border:none windowtext 1.0pt;padding:0cm;background:white'><span
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>在Ｃ语言中可从不同的角度对函数分类。</span></span></strong><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:green;border:none windowtext 1.0pt;
padding:0cm'><span style='text-decoration:initial'>从函数定义的角度看，函数可分为库函数和用户定义函数两种。</span></span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>库函数：由Ｃ系统提供，用户无须定义，也不必在程序中作类型说明，只需在程序前包含有该函数原型的头文件即可在程序中直接调用。在前面各章的例题中反复用到</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>printf</span><span
style='font-family:宋体;color:#555555'>、</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555'>scanf</span><span style='font-family:宋体;
color:#555555'>、</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555'>getchar</span><span style='font-family:宋体;color:#555555'>、</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>putchar</span><span
style='font-family:宋体;color:#555555'>、</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555'>gets</span><span style='font-family:宋体;
color:#555555'>、</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555'>puts</span><span style='font-family:宋体;color:#555555'>、</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>strcat</span><span
style='font-family:宋体;color:#555555'>等函数均属此类。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>用户定义函数：由用户按需要写的函数。对于用户自定义函数，不仅要在程序中定义函数本身，而且在主调函数模块中还必须对该被调函数进行类型说明，然后才能使用。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:green;border:none windowtext 1.0pt;
padding:0cm'><span style='text-decoration:initial'>Ｃ语言的函数兼有其它语言中的函数和过程两种功能，从这个角度看，又可把函数分为有返回值函数和无返回值函数两种。</span></span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>有返回值函数：此类函数被调用执行完后将向调用者返回一个执行结果，称为函数返回值。如数学函数即属于此类函数。由用户定义的这种要返回函数值的函数，必须在函数定义和函数说明中明确返回值的类型。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>无返回值函数：此类函数用于完成某项特定的处理任务，执行完成后不向调用者返回函数值。这类函数类似于其它语言的过程。由于函数无须返回值，用户在定义此类函数时可指定它的返回为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>“</span><span
style='font-family:宋体;color:#555555'>空类型</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>”</span><span
style='font-family:宋体;color:#555555'>，空类型的说明符为</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>“void”</span><span
style='font-family:宋体;color:#555555'>。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>3.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:green;border:none windowtext 1.0pt;
padding:0cm'><span style='text-decoration:initial'>从主调函数和被调函数之间数据传送的角度看又可分为无参函数和有参函数两种。</span></span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>无参函数：函数定义、函数说明及函数调用中均不带参数。主调函数和被调函数之间不进行参数传送。此类函数通常用来完成一组指定的功能，可以返回或不返回函数值。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>有参函数：也称为带参函数。在函数定义及函数说明时都有参数，称为形式参数</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>(</span><span
style='font-family:宋体;color:#555555'>简称为形参</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>)</span><span
style='font-family:宋体;color:#555555'>。在函数调用时也必须给出参数，称为实际参数</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>(</span><span
style='font-family:宋体;color:#555555'>简称为实参</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>)</span><span
style='font-family:宋体;color:#555555'>。进行函数调用时，主调函数将把实参的值传送给形参，供被调函数使用。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>4.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:green;border:none windowtext 1.0pt;
padding:0cm'><span style='text-decoration:initial'>Ｃ语言提供了极为丰富的库函数，这些库函数又可从功能角度作以下分类。</span></span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>字符类型分类函数：用于对字符按</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>ASCII</span><span
style='font-family:宋体;color:#555555'>码分类：字母，数字，控制字符，分隔符，大小写字母等。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>转换函数：用于字符或字符串的转换；在字符量和各类数字量</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>(</span><span
style='font-family:宋体;color:#555555'>整型，实型等</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>)</span><span
style='font-family:宋体;color:#555555'>之间进行转换；在大、小写之间进行转换。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>3.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>目录路径函数：用于文件目录和路径操作。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>4.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>诊断函数：用于内部错误检测。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>5.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>图形函数：用于屏幕管理和各种图形功能。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>6.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>输入输出函数：用于完成输入输出功能。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>7.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>接口函数：用于与</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>DOS</span><span
style='font-family:宋体;color:#555555'>，</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555'>BIOS</span><span style='font-family:宋体;
color:#555555'>和硬件的接口。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>8.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>字符串函数：用于字符串操作和处理。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>9.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>内存管理函数：用于内存管理。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>10.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>数学函数：用于数学函数计算。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>11.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>日期和时间函数：用于日期，时间转换操作。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>12.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>进程控制函数：用于进程管理和控制。</span></p>

<p class=MsoNormal align=left style='margin-left:45.0pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>13.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>其它函数：用于其它各种功能。</span></p>

<h1><span lang=EN-US style='font-size:10.5pt;font-family:"Tahoma","sans-serif";
color:#555555;background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; </span><span style='font-size:
10.5pt;color:#555555;background:white'>以上各类函数不仅数量多，而且有的还需要硬件知识才会使用，因此要想全部掌握则需要一个较长的学习过程。应首先掌握一些最基本、最常用的函数，再逐步深入。由于课时关系，我们只介绍了很少一部分库函数，其余部分读者可根据需要查阅</span><span
lang=EN-US style='font-size:10.5pt;font-family:"Tahoma","sans-serif";
color:#555555;background:white'>C</span><span style='font-size:10.5pt;
color:#555555;background:white'>语言函数手册。</span></span><span lang=EN-US
style='font-size:10.5pt;font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-size:10.5pt;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>还应该指出的是，在Ｃ语言中，所有的函数定义，包括主函数</span><span
lang=EN-US style='font-size:10.5pt;font-family:"Tahoma","sans-serif";
color:#555555;background:white'>main</span><span style='font-size:10.5pt;
color:#555555;background:white'>在内，都是平行的。也就是说，在一个函数的函数体内，不能再定义另一个函数，即不能嵌套定义。但是函数之间允许相互调用，也允许嵌套调用。习惯上把调用者称为主调函数。函数还可以自己调用自己，称为递归调用。</span></span><span
lang=EN-US style='font-size:10.5pt;font-family:"Tahoma","sans-serif";
color:#555555'><br style='text-decoration:initial;orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>main </span></span><span style='font-size:10.5pt;
color:#555555;background:white'>函数是主函数，它可以调用其它函数，而不允许被其它函数调用。因此，Ｃ程序的执行总是从</span><span
lang=EN-US style='font-size:10.5pt;font-family:"Tahoma","sans-serif";
color:#555555;background:white'>main</span><span style='font-size:10.5pt;
color:#555555;background:white'>函数开始，完成对其它函数的调用后再返回到</span><span lang=EN-US
style='font-size:10.5pt;font-family:"Tahoma","sans-serif";color:#555555;
background:white'>main</span><span style='font-size:10.5pt;color:#555555;
background:white'>函数，最后由</span><span lang=EN-US style='font-size:10.5pt;
font-family:"Tahoma","sans-serif";color:#555555;background:white'>main</span><span
style='font-size:10.5pt;color:#555555;background:white'>函数结束整个程序。一个Ｃ源程序必须有，也只能有一个主函数</span><span
lang=EN-US style='font-size:10.5pt;font-family:"Tahoma","sans-serif";
color:#555555;background:white'>main</span><span style='font-size:10.5pt;
color:#555555;background:white'>。</span></span></h1>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

</div>

</body>

</html>
